package com.david.flowable.mapper;

import com.david.flowable.pojo.dto.FormFlowDTO;
import com.david.flowable.pojo.vo.FormFlowVO;
import com.david.flowable.pojo.vo.FormVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface FlowFormMapper {
//    @Insert("insert into sys_process_form (name, `key`, form_content, create_by, update_by, create_time, update_time) values (#{flowFormVO.name}, #{flowFormVO.key}, #{flowFormVO.formContent}, #{flowFormVO.createBy}, #{flowFormVO.updateBy},\n" +
//            "                #{flowFormVO.createTime}, #{flowFormVO.updateTime})")
    int insertForm(@Param("formVO") FormVO formVO);

    @Insert("insert into sys_process_form_flow (process_name, form_id, flow_id, app_name, remark, status, create_time, update_time) VALUES ( #{processName},#{formId},#{flowId},#{appName},#{remark},#{status},#{createTime},#{updateTime})")
    void insertFormFlow(FormFlowVO formFlowVO);

    List<FormFlowDTO> selectFormFlow(FormFlowDTO formFlowDTO);

    @Select("select id, name, `key`, form_content, create_by, update_by, create_time, update_time from sys_process_form where id = #{formId}")
    FormVO selectFormById(Integer formId);

    void updateFormFlowStatus(FormFlowDTO formFlowDTO);

    @Delete("delete from sys_process_form where id = #{formId}")
    void deleteForm(Integer formId);

    @Delete("delete from sys_process_form_flow where id = #{id}")
    void deleteFormFlow(Integer id);

    @Update("update sys_process_form_flow set process_name = #{processName}, form_id=#{formId}, flow_id = #{flowId}, remark=#{remark}, app_name=#{appName}, update_time=#{updateTime}  where id = #{id}")
    void updateFormFlow(FormFlowVO formFlowVO);

//    @Select("select id, process_name, form_id, flow_id, app_name, remark, status, create_time, update_time from sys_process_form_flow ")
//    List<FormFlowVO> selectFormFlow(FormFlowDTO formFlowDTO);
}
